<?php


use Phinx\Seed\AbstractSeed;

class Routes extends AbstractSeed
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * https://book.cakephp.org/phinx/0/en/seeding.html
     */
    public function run(): void
    {
        $sql = "
        INSERT INTO `plug`.`v_routes_api`(`id`, `name`, `module`, `controller`, `action`, `routes_id`, `create_time`, `update_time`, `status`) VALUES (1, '【管理端】菜单列表', 'admin', 'auth', 'getRoutes', 1, '2023-03-29 21:50:16', '2023-03-29 21:50:18', 1);
        INSERT INTO `plug`.`v_routes_api`(`id`, `name`, `module`, `controller`, `action`, `routes_id`, `create_time`, `update_time`, `status`) VALUES (2, '【管理端】角色列表', 'admin', 'auth', 'getRoles', 1, '2023-03-29 21:50:56', '2023-03-29 21:50:57', 1);
        INSERT INTO `plug`.`v_routes_api`(`id`, `name`, `module`, `controller`, `action`, `routes_id`, `create_time`, `update_time`, `status`) VALUES (3, '【管理端】登录', 'admin', 'login', 'login', 0, '2023-03-29 21:50:56', '2023-03-29 21:50:57', 1);
        INSERT INTO `plug`.`v_routes_api`(`id`, `name`, `module`, `controller`, `action`, `routes_id`, `create_time`, `update_time`, `status`) VALUES (4, '【管理端】短信登陆', 'admin', 'login', 'smsLogin', 0, '2023-03-29 21:51:44', '2023-03-29 21:51:48', 1);
        INSERT INTO `plug`.`v_routes_api`(`id`, `name`, `module`, `controller`, `action`, `routes_id`, `create_time`, `update_time`, `status`) VALUES (5, '【管理端】获取图形验证码', 'admin', 'login', 'getValidatCode', 0, '2023-03-29 21:52:20', '2023-03-29 21:52:22', 1);
        INSERT INTO `plug`.`v_routes_api`(`id`, `name`, `module`, `controller`, `action`, `routes_id`, `create_time`, `update_time`, `status`) VALUES (6, '【管理端】角色列表', 'admin', 'role', 'list', 0, '2023-03-29 21:52:55', '2023-03-29 21:52:57', 1);
       ";
       $data = [
            ['name'=>'【管理端】菜单列表'      ,'module'=>'admin', 'controller'=>'auth' ,'action'=>'getRoutes'     ,'routes_id'=>'1','status'=>1],
            ['name'=>'【管理端】角色列表'      ,'module'=>'admin', 'controller'=>'auth' ,'action'=>'getRoles'      ,'routes_id'=>'1','status'=>1],
            ['name'=>'【管理端】登录'          ,'module'=>'admin', 'controller'=>'login','action'=>'login'         ,'routes_id'=>'0','status'=>1],
            ['name'=>'【管理端】短信登陆'      ,'module'=>'admin', 'controller'=>'login','action'=>'smsLogin'      ,'routes_id'=>'0','status'=>1],
            ['name'=>'【管理端】获取图形验证码','module'=>'admin', 'controller'=>'login','action'=>'getValidatCode','routes_id'=>'0','status'=>1],
            ['name'=>'【管理端】角色列表'      ,'module'=>'admin', 'controller'=>'role' ,'action'=>'list'          ,'routes_id'=>'0','status'=>1],
        ];
        $posts = $this->table('routes_api');
        $posts->insert($data)
          ->saveData();
    }
}


// CREATE TABLE `v_plugs` (
//     `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
//     `name` varchar(64) DEFAULT '' COMMENT '插件名称',
//     `author` varchar(32) DEFAULT '' COMMENT '作者',
//     `introduction` text DEFAULT '' COMMENT '简介',
//     `git_url` text DEFAULT '' COMMENT 'git地址',
//     `create_time` datetime DEFAULT NULL,
//     `update_time` datetime DEFAULT NULL,
//     `status` tinyint(1) unsigned DEFAULT 1 COMMENT '状态',
//     PRIMARY KEY (`id`)
//   ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
// INSERT INTO `plug`.`v_plugs`(`id`, `name`, `author`, `introduction`, `git_url`, `create_time`, `update_time`, `status`) VALUES (1, 'plug-formwark-demo', 'XiaoMingYu', '一个框架demo', 'https://gitee.com/XiaoMingYu/plug-formwark-demo.git', '2023-02-06 19:59:10', '2023-02-06 19:59:12', 1);